package com.mycoffee.ui;

import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;

import com.example.mycoffee.MainActivity;
import com.example.mycoffee.R;

import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.widget.LinearLayout;
import android.widget.ListView;

public class GetPictureFrInter extends MainActivity {

	private LinearLayout search1;
	private ListView listView;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_getinterpicture);
		listView=(ListView) findViewById(R.id.listView);
		String url="http://img.ui.cn/data/file/2/3/0/330032.jpg?v=1445917034";
		Bitmap bitmap=getHttpBitmap(url);
		
	}
	private Bitmap getHttpBitmap(String url) {
		Bitmap bitmap=null;
		try {
			URL picture =new URL(url);
			InputStream inpus=picture.openStream();
			bitmap=BitmapFactory.decodeStream(inpus);
			inpus .close();
			
		} catch (MalformedURLException e) {
			e.printStackTrace();
		}
		catch (IOException e) {
			e.printStackTrace();
		}
		return null;
	}

	
}
